package com.runvp.service.biz.service.impl;

import java.util.List;

import com.runvp.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.runvp.service.biz.mapper.BizCustomerMapper;
import com.runvp.service.biz.domain.BizCustomer;
import com.runvp.service.biz.service.IBizCustomerService;
import com.runvp.common.core.text.Convert;

/**
 * 消费者Service业务层处理
 *
 * @author runvp
 * @date 2022-09-15
 */
@Service
public class BizCustomerServiceImpl implements IBizCustomerService {
    @Autowired
    private BizCustomerMapper bizCustomerMapper;

    /**
     * 查询消费者
     *
     * @param id 消费者主键
     * @return 消费者
     */
    @Override
    public BizCustomer selectBizCustomerById(Long id) {
        return bizCustomerMapper.selectBizCustomerById(id);
    }
    /**
     * 查询消费者
     *
     * @param openId
     * @return 消费者
     */
    @Override
    public BizCustomer selectBizCustomerByOpenId(String openId){
        return bizCustomerMapper.selectBizCustomerByOpenId(openId);
    }
    /**
     * 查询消费者列表
     *
     * @param bizCustomer 消费者
     * @return 消费者
     */
    @Override
    public List<BizCustomer> selectBizCustomerList(BizCustomer bizCustomer) {
        return bizCustomerMapper.selectBizCustomerList(bizCustomer);
    }

    /**
     * 新增消费者
     *
     * @param bizCustomer 消费者
     * @return 结果
     */
    @Override
    public int insertBizCustomer(BizCustomer bizCustomer) {
        bizCustomer.setCreateTime(DateUtils.getNowDate());
        return bizCustomerMapper.insertBizCustomer(bizCustomer);
    }

    /**
     * 修改消费者
     *
     * @param bizCustomer 消费者
     * @return 结果
     */
    @Override
    public int updateBizCustomer(BizCustomer bizCustomer) {
        bizCustomer.setUpdateTime(DateUtils.getNowDate());
        return bizCustomerMapper.updateBizCustomer(bizCustomer);
    }

    /**
     * 批量删除消费者
     *
     * @param ids 需要删除的消费者主键
     * @return 结果
     */
    @Override
    public int deleteBizCustomerByIds(String ids) {
        return bizCustomerMapper.deleteBizCustomerByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除消费者信息
     *
     * @param id 消费者主键
     * @return 结果
     */
    @Override
    public int deleteBizCustomerById(Long id) {
        return bizCustomerMapper.deleteBizCustomerById(id);
    }
}
